/*
package com.wx.registerclient.proxy;



import com.wx.registerclient.annotation.PathMapping;
import com.wx.registerclient.annotation.ResponseByGet;
import com.wx.registerclient.config.HttpClientConfig;
import com.wx.registerclient.config.RemoteTransfer;
import com.wx.registerclient.entity.ServerInfomation;
import org.aspectj.lang.ProceedingJoinPoint;

import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;


*/
/**
 * 对于接口方法进行代理
 * 简化远程调用
 *//*

@Component
@Aspect
public class RemoteInvokeProxy  {

    @Autowired
    private HttpClientConfig httpClientConfig;
    @Autowired
    private RemoteTransfer remoteTransfer;
    @Pointcut("@annotation(com.wx.registerclient.annotation.PathMapping)")
    public void pc(){}

    */
/**
     * 对于所有使用了@ResponseByGet这个注解的方法进行增强
     * 返回远程调用以后远程方法返回的结果
     * @param pjp
     * @return
     *//*

    @Around("pc()")
    public Object remoteInvoke(ProceedingJoinPoint pjp){

        // 前置处理
        MethodSignature signature = (MethodSignature) pjp.getSignature();
        Method method = signature.getMethod();

        Class<? extends MethodSignature> aClass = signature.getClass();
        ResponseByGet responseByGet = aClass.getAnnotation(ResponseByGet.class);

        // 获得请求的服务名
        String sreverName = responseByGet.sreverName();

        // 发起远程调用获得ip与端口号
        ServerInfomation object = httpClientConfig.getObject(sreverName);
        //端口号
        String ip = object.getIp();
        int port = object.getPort();
        // 获得uri

        PathMapping pathMapping = method.getAnnotation(PathMapping.class);
        String path = pathMapping.path();
        // 获得url
        String url="http://"+ip+":"+port+path;
        // 获得参数
        Object[] args = pjp.getArgs();
        // 获得返回值类型
        Class returnType = signature.getReturnType();

        Object result = remoteTransfer.getResult(returnType, url, args);
        System.out.println("被aop拦截到");
        try {
            pjp.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return  result;

    }



}
*/
